package com.zhengxin.web;

import com.zhengxin.pojo.Employee;
import com.zhengxin.utils.UserContext;

public class LoginAction extends BaseAction{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	//封装登录数据
	private Employee employee;

	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}
	
	public String login(){
		//调用登录service
		Employee emp=employeeService.login(employee);
		//判断
		if (emp != null) {
			//登录成功,保存到session
			UserContext.setUser(emp);
			return SUCCESS;
		} else {
			//登录失败,需要更多的输入(input)
			return INPUT;
		}
		
	}
	
	//退出系统
	public String out(){
		UserContext.out();
		return INPUT;
	}
}
